package com.kiyuumirai.movieclient.controller;

import com.kiyuumirai.utils.model.dto.TicketDTO;
import com.kiyuumirai.utils.model.vo.ResultVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author MirAi
 * @description 票务控制器
 * @date 2020/11/30 16:30
 */
@RestController
public class TicketController {

    /** rest模板 */
    @Resource
    private RestTemplate restTemplate;

    @PostMapping("/tickets")
    public ResultVO buy(@RequestBody TicketDTO ticketDTO) {

        return restTemplate.postForEntity("http://localhost:8848/tickets", ticketDTO, ResultVO.class).getBody();
    }
}
